package me.ratel.demo.eBook.interfaces.web;

import me.ratel.demo.eBook.infrastructure.exceptions.IError;
import me.ratel.demo.eBook.infrastructure.exceptions.IErrorHeader;

/**
 * @author: zhouyaming
 * @time: 2016/4/29 17:52
 */
public class WebError implements IError {
    private final IErrorHeader errorHeader;

    private final Object errorBody;

    public WebError() {
        this(null, null);
    }

    public WebError(IErrorHeader errorHeader) {
        this(errorHeader, null);
    }

    public WebError(IError iError) {
        this(iError.getErrorHeader(), iError.getErrorBody());
    }

    public WebError(IErrorHeader errorHeader, Object errorBody) {
        this.errorHeader = errorHeader;
        this.errorBody = errorBody;
    }

    @Override public IErrorHeader getErrorHeader() {
        return this.errorHeader;
    }

    @Override public Object getErrorBody() {
        return errorBody;
    }
}
